home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9607 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: rac1.wam.umd.edu!kwhite
  2. From: Brainman <kwhite@wam.umd.edu>
  3. Newsgroups: comp.lang.c
  4. Subject: 32 bit int binary file port
  5. Date: Mon, 11 Mar 1996 21:39:14 -0500
  6. Organization: University of Maryland College Park
  7. Message-ID: <Pine.ULT.3.91.960311211827.5811A-100000@rac1.wam.umd.edu>
  8. NNTP-Posting-Host: rac1.wam.umd.edu
  9. Mime-Version: 1.0
  10. Content-Type: TEXT/PLAIN; charset=US-ASCII
  11.  
  12.  
  13. Hey all,
  14.  
  15. In the process of upgrading Borland 4.52 to the "PowerPack" 32bit DOS
  16. extenders, I have discovered that sizeof(int) in 32 bit protected mode
  17. is now 4 instead of 2.
  18.  
  19. The problem is that I need to read in several huge (4Meg+) binary
  20. files of ints that were construced as 2 byte chunks.  Because these
  21. files are so huge, I'd rather not have to do any massively sophisticated
  22. bit shifting on each 2-byte word, if possible (if I read the entire file
  23. in with fread in 64K chunks of 1 byte, I can get the values into memory
  24. pretty quickly -- I suspect that I'd suffer a huge performance hit
  25. by converting the ints one at a time).
  26.  
  27. Is there a standard function or algorithm on 32 bit platforms to read two 
  28. bytes and make them 4 byte "ints" after the fact, as it were?
  29.  
  30. Any help is much appreciated.
  31.  
  32. Kenn White
  33. kwhite@wam.umd.edu
  34. white@baldr.niaaa.nih.gov
  35.  
  36.  
  37.